# -*- coding: utf-8 -*-
# @Time    : 2021/3/31 18:41
# @Author  : mokez
# @Email   : 1569089678@qq.com
# @File    : tree.py
# @Software: PyCharm

import os

path = os.getcwd()


def tree(path, i):
    # 遍历当前目录
    # print(path)
    for filename in os.listdir(path):
        # 文件
        if os.path.isfile(os.path.join(path, filename)):
            # pass
            print("----" * i + filename)
        # 如果是目录
        if os.path.isdir(os.path.join(path, filename)):
            print("----" * i + filename)
            # filename = path+"\\"+filename
            # print(filename)
            tree(os.path.join(path, filename), i + 1)


tree(path, 0)
